import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Alert, Card, Typography } from 'antd';
import React from 'react';

/**
 * 管理员页面组件
 * 仅管理员可访问
 */
const Admin: React.FC = () => {
  const intl = useIntl();
  
  // 提取国际化文本，提高可读性
  const pageTitle = intl.formatMessage({
    id: 'pages.admin.subPage.title',
    defaultMessage: '此页面仅管理员可查看',
  });
  
  const alertMessage = intl.formatMessage({
    id: 'pages.welcome.alertMessage',
    defaultMessage: '更快、更强的重型组件已经发布。',
  });

  // 提取样式对象，便于维护
  const styles = {
    alert: {
      margin: -12,
      marginBottom: 48,
    },
    title: { 
      textAlign: 'center' as const 
    },
    footer: { 
      textAlign: 'center' as const, 
      marginTop: 24 
    }
  };

  return (
    <PageContainer content={pageTitle}>
      <Card>
        <Alert
          message={alertMessage}
          type="success"
          showIcon
          banner
          style={styles.alert}
        />
        <Typography.Title level={2} style={styles.title}>
          <SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
        </Typography.Title>
      </Card>
      <p style={styles.footer}>
        想要添加更多页面？请参考{' '}
        <a 
          href="https://pro.ant.design/docs/block-cn" 
          target="_blank" 
          rel="noopener noreferrer"
        >
          使用区块
        </a>
        。
      </p>
    </PageContainer>
  );
};

export default Admin;
